package com.xzq.entity;

import java.io.Serializable;
import java.sql.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
/**
 * 员工实体类
 * @author Adam
 *
 */
@Entity
public class Emp implements Serializable {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	@Column(length=20,nullable=false)
	private String name;
	@Column(length=2,nullable=false)
	private String sex;
	@Column
	private Date hiredate;
	@Column
	private Double salary;
	@ManyToOne(cascade={CascadeType.MERGE},fetch=FetchType.EAGER)
	@JoinColumn(name="role_id")
	private Role role;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public Date getHiredate() {
		return hiredate;
	}
	public void setHiredate(Date hiredate) {
		this.hiredate = hiredate;
	}
	public Double getSalary() {
		return salary;
	}
	public void setSalary(Double salary) {
		this.salary = salary;
	}
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
	public Emp() {
		super();
	}
	
	public Emp(Integer id, String name, String sex, Date hiredate, Double salary) {
		super();
		this.id = id;
		this.name = name;
		this.sex = sex;
		this.hiredate = hiredate;
		this.salary = salary;
	}
	public Emp(String name, String sex, Date hiredate, Double salary) {
		super();
		this.name = name;
		this.sex = sex;
		this.hiredate = hiredate;
		this.salary = salary;
	}
	
}
